package com.ruoyi.iot.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iot.mapper.FacDeviceBasicMapper;
import com.ruoyi.iot.domain.FacDeviceBasic;
import com.ruoyi.iot.service.IFacDeviceBasicService;

/**
 * 设备基础Service业务层处理
 *
 * @author rww
 * @date 2024-06-22
 */
@Service
public class FacDeviceBasicServiceImpl implements IFacDeviceBasicService
{
    @Autowired
    private FacDeviceBasicMapper facDeviceBasicMapper;

    /**
     * 查询设备基础
     *
     * @param id 设备基础主键
     * @return 设备基础
     */
    @Override
    public FacDeviceBasic selectFacDeviceBasicById(Long id)
    {
        return facDeviceBasicMapper.selectFacDeviceBasicById(id);
    }

    /**
     * 查询设备基础列表
     *
     * @param facDeviceBasic 设备基础
     * @return 设备基础
     */
    @Override
    public List<FacDeviceBasic> selectFacDeviceBasicList(FacDeviceBasic facDeviceBasic)
    {
        return facDeviceBasicMapper.selectFacDeviceBasicList(facDeviceBasic);
    }

    /**
     * 新增设备基础
     *
     * @param facDeviceBasic 设备基础
     * @return 结果
     */
    @Override
    public int insertFacDeviceBasic(FacDeviceBasic facDeviceBasic)
    {
        facDeviceBasic.setId(IdUtil.getSnowflakeNextId());
        facDeviceBasic.setCreateTime(DateUtils.getNowDate());
        return facDeviceBasicMapper.insertFacDeviceBasic(facDeviceBasic);
    }

    /**
     * 修改设备基础
     *
     * @param facDeviceBasic 设备基础
     * @return 结果
     */
    @Override
    public int updateFacDeviceBasic(FacDeviceBasic facDeviceBasic)
    {
        return facDeviceBasicMapper.updateFacDeviceBasic(facDeviceBasic);
    }

    /**
     * 批量删除设备基础
     *
     * @param ids 需要删除的设备基础主键
     * @return 结果
     */
    @Override
    public int deleteFacDeviceBasicByIds(Long[] ids)
    {
        return facDeviceBasicMapper.deleteFacDeviceBasicByIds(ids);
    }

    /**
     * 删除设备基础信息
     *
     * @param id 设备基础主键
     * @return 结果
     */
    @Override
    public int deleteFacDeviceBasicById(Long id)
    {
        return facDeviceBasicMapper.deleteFacDeviceBasicById(id);
    }

    @Override
    public List<FacDeviceBasic> getDevicePList(FacDeviceBasic facDeviceBasic) {
        return facDeviceBasicMapper.getDevicePList(facDeviceBasic);
    }

    @Override
    public List<FacDeviceBasic> getChildDeviceById(FacDeviceBasic facDeviceBasic) {
        return facDeviceBasicMapper.getChildDeviceById(facDeviceBasic);
    }

    @Override
    public FacDeviceBasic selectNewBxSbInfo(){
        return facDeviceBasicMapper.selectNewBxSbInfo();
    }

}
